<template>
	<view class="hexiao-container mainpadding mainbgc" v-show="show">
		<view class="flexcenter1" v-if="!list.data.length">
			<view class="placeholderimg" style="margin-top: 300rpx;">
				<image src="../../static/images/bg-icons/placeholderimg.png" mode=""></image>
			</view>
			<view class="zanwushuju">暂无数据~</view>
		</view>
		<view class="recordsItem ffffff mainpadding border-r2 fS margin-top" v-for="item in list.data" :key="item.id">
			<view class="dateAstatus flexleft2">
				<view class="date">{{item.createtime_text}}</view>
				<view class="status">已核销</view>
			</view>
			<view v-for="item1 in item.goods" :key="item1.id">
				<view class="productName margin-top">商品名:{{item1.tour_name}}</view>
				<view class="flexleft">
					<view class="productPrice margint17 margin-right">数量：<text class="oC">{{item1.total_num}}</text></view>
					<view class="productPrice margint17">合计金额：<text class="oC">{{item1.total_price}}</text></view>
				</view>
				<view class="productNumber margint17">订单号：{{item.order_no}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				show:false,
			}
		},
		onShow(){
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				httpRequest.request('api/tourorder/hxMyOrder', 'GET', {
					page: page || 1,
					limit: _this.limit,
				}, false, false, false).then(res => {
					this.show=true
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					this.show=true
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.dateAstatus {
		border-bottom: 2rpx solid #F1F1F1;
		padding-bottom: 30rpx;
	}

	.recordsItem:first-child {
		margin-top: 0;
	}

	.date {
		font-size: 26rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #333333;
	}

	.status {
		font-size: 26rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #00D2E1;
	}

	.margint17 {
		margin-top: 17rpx;
	}

	.fS {
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.oC {
		color: #FF5C00;
	}
</style>
